<!-- 编辑人员 -->
<template>
  <div>
    <dt-info :label-width="90" ref="info1" :options="options" style="width: 100%"></dt-info>
    <!--重置密码-->
    <dt-modal-edit ref="resetPwd" title="密码重置确认" okText="立即重置" @ok="resetPwdFun" :transfer="true">
      <p>请确认，是否对{{ messInfo.name + '(' + messInfo.workNo + ')' }}的登录密码进行重置？</p>
    </dt-modal-edit>
  </div>
</template>

<script>
  import editMgr from '../opt/edit.js'
  import ruleOpt from '@/biz/option/rule.js'

  const validatePhone = (rule, value, callback) => {
    if (!value || !/^1[3456789]\d{9}$/.test(value)) callback(new Error('请输入正确的手机号'))
    else callback()
  }
  export default {
    props: ['messInfo'],
    data() {
      return {
        formValidate: {
          staffTel: '',
          staffPassword: ''
        },
        options: [],
        info: {
          workNo: '',
          validate: '',
          name: '',
          rankName: '',
          status: '',
          phone: '',
          password: '',
          jyCompile: false
        }
      }
    },

    mounted() {
      this.options = editMgr.options(this)
      this.$refs.info1.init(this.options, this.info)
    },
    created() {
      this.info = {
        workNo: this.messInfo.workNo,
        validate: this.messInfo.validate,
        name: this.messInfo.name,
        rankName: this.messInfo.rankName,
        status: this.messInfo.status,
        phone: this.messInfo.phone,
        password: '',
        jyCompile: this.messInfo.jyCompile,
        jyCompileStr: this.messInfo.jyCompileStr,
        dtCompileStr: this.messInfo.dtCompileStr
      }
    },
    methods: {
      resetPwdFun() {
        let num = ''
        for (var i = 0; i < 3; i++) {
          num += Math.floor(Math.random() * 10)
        }

        this.info.password = 'Password' + num
        this.$emit('onOperate', true)
      },
      successFun() {
        this.$refs.resetPwd.hide()
      }
    }
  }
</script>

<style lang="scss" scoped></style>
